package com.pain.scaffold.admin.controller;

import cn.hutool.core.io.FileUtil;
import cn.hutool.extra.qrcode.QrCodeUtil;
import com.pain.scaffold.admin.config.QrCodeConfig;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.io.File;

@RestController
@RequestMapping("/qrcode")
public class QrCodeController {

    @Resource
    QrCodeConfig qrCodeConfig;

    @GetMapping("/generate")
    public void getQrCode(){
        String msg = "https://blog.csdn.net/WatereElement?spm=1011.2415.3001.5343";
        File file = QrCodeUtil.generate(msg, qrCodeConfig.transform(), FileUtil.file("D:/qrcode.jpg"));
    }

}
